/**
 * @param {number} rowIndex
 * @return {number[]}
 */
export var getRow = function (rowIndex) {
  let preRow = [1]
  for (let i = 1; i <= rowIndex; i++) {
    const curRow = []
    for (let j = 0; j <= i; j++) {
      const val = (preRow[j - 1] || 0) + (preRow[j] || 0)
      curRow.push(val)
    }
    preRow = curRow
  }
  return preRow
}
